package com.zw.a.basic.a13.demo06_synchronized_method;

//普通类, 里边有两个方法, 一个用同步代码块加锁, 一个用同步方法实现.
public class Demo {
    public static void show1() {       //作用: 输出 itcast, 然后换行.
        synchronized(Demo.class) {
            System.out.print("i");
            System.out.print("t");
            System.out.print("c");
            System.out.print("a");
            System.out.print("s");
            System.out.print("t");
            System.out.print("\r\n");
        }
    }

    public synchronized static void show2() {       //作用: 输出 黑马程序员, 然后换行.
        System.out.print("黑");
        System.out.print("马");
        System.out.print("程");
        System.out.print("序");
        System.out.print("员");
        System.out.print("\r\n");
    }
}
